﻿using System;
using System.Web.Services;
using Monkey.Warrenty.Biz;

namespace MonkeyWarranty.Web.InstantTickets
{
    public partial class List : System.Web.UI.Page
    {
        #region Properties

        private static InstantTicketBiz _instantTicketBiz;
        private static InstantTicketBiz InstantTicketManager
        {
            get { return _instantTicketBiz ?? (_instantTicketBiz = new InstantTicketBiz()); }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        [WebMethod(EnableSession = true)]
        public static object NewTicketListByFilter(int jtStartIndex, int jtPageSize, string jtSorting)
        {
            return InstantTicketManager.GetTicketsWs(jtStartIndex, jtPageSize, jtSorting, 1);
        }

        [WebMethod(EnableSession = true)]
        public static object ProcessingTicketListByFilter(int jtStartIndex, int jtPageSize, string jtSorting)
        {
            return InstantTicketManager.GetTicketsWs(jtStartIndex, jtPageSize, jtSorting, 2);
        }

        [WebMethod(EnableSession = true)]
        public static object CompletedTicketListByFilter(int jtStartIndex, int jtPageSize, string jtSorting)
        {
            return InstantTicketManager.GetTicketsWs(jtStartIndex, jtPageSize, jtSorting, 3);
        }

        [WebMethod(EnableSession = true)]
        public static object DeleteTicket(long Id)
        {
            InstantTicketManager.DeleteTicket(Id);
            return new { Result = "OK" };
        }
    }
}